package com.shopping.product.vo;

import com.shopping.product.entity.SkuImagesEntity;
import com.shopping.product.entity.SkuInfoEntity;
import com.shopping.product.entity.SpuInfoDescEntity;
import lombok.Data;

import java.util.List;

@Data
public class SkuItemVo {
    SkuInfoEntity info;
    Boolean hasStock = true;
    List<SkuImagesEntity> images;
    List<SkuItemSaleAttrVo> saleAttr;
    SpuInfoDescEntity desc;
    List<SpuItemGroupAttrVo> groupAttrs;


    /**
     * sku 商品销售属性视图对象
     */
    @Data
    public static class SkuItemSaleAttrVo {
        private Long attrId;
        private String attrName;
        private List<AttrValueWithSkuIdVo> attrValues;
    }

    /**
     * 每个销售属性在哪些 sku 中出现过，方便求交集
     */
    @Data
    public static class AttrValueWithSkuIdVo {
        private String attrValue;
        private String skuIds;
    }

    /**
     * 规格与包装：分组 > 属性键值对
     */
    @Data
    public static class SpuItemGroupAttrVo {
        private String groupName;
        private List<SpuBaseAttrVo> attrs;
    }

    /**
     * spu 基本属性键值对
     */
    @Data
    public static class SpuBaseAttrVo {
        private String attrName;
        private String attrValue;
    }

}
